package com.sxt.springsecuritytest2;

import com.sxt.springsecuritytest2.mapper.SysUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

//开启Security方法注解
@EnableGlobalMethodSecurity(securedEnabled = true)
@SpringBootApplication
public class SpringSecurityTest2Application {

    @Autowired
    private static SysUserMapper sysUserMapper;

    public static void main(String[] args) {
        SpringApplication.run(SpringSecurityTest2Application.class, args);
        String str = new BCryptPasswordEncoder().encode("admin");
        System.out.println(":::::::::::");
        System.out.println(str);
        String result = "";
//        try {
//        }catch (NullPointerException e){
//            e.printStackTrace();
//        }
            result = sysUserMapper.selectByPrimaryKey(1).toString();
        System.out.println(result);

    }

    //加入IOC容器
    //@Bean
    //public BCryptPasswordEncoder bCryptPasswordEncoder(){
     //   return new BCryptPasswordEncoder();
    //}


}
